<?php
/**
 * @author spenceryg
 * @date 2022/11/26
 * @time 10:08 下午
 * @focus love & life
 */


namespace app\common\traits\business;


trait BusinessTrait
{
    public static function getById($id)
    {
        return self::$model::find($id);
    }


    public static function getListPaginate($where = [], $order = 'id desc'): array
    {
        $data = self::$model::order($order)->paginate(10);
        return  [
            'data' => $data,
            'paginate' => $data ? $data->render() : ''
        ];
    }
}
